# Maintainer: Luca Weiss <luca@lucaweiss.eu>
pkgname=lomiri-location-service
pkgver=3.1.0
pkgrel=7
pkgdesc="Location service aggregating position/velocity/heading updates and exporting them over dbus"
arch="all"
url="https://gitlab.com/ubports/development/core/location-service"
license="GPL-3.0-only AND LGPL-3.0-only"
depends_dev="
	boost-dev
	dbus-cpp-dev
	dbus-dev
	gflags-dev
	glog-dev
	gpsd-dev
	json-c-dev
	libapparmor-dev
	lomiri-trust-store-dev
	net-cpp-dev
	process-cpp-dev
	properties-cpp-dev
	qt5-qtbase-dev
	qt5-qtlocation-dev
	"
makedepends="$depends_dev
	cmake-extras
	gettext
	gmock
	gtest-dev
	samurai
	"
checkdepends="coreutils"
source="https://gitlab.com/ubports/development/core/location-service/-/archive/$pkgver/location-service-$pkgver.tar.gz
	cstdint.patch
	glog.patch
	0001-data-CMakeLists.txt-don-t-hardcode-lib-paths-when-in.patch
	"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
builddir="$srcdir/location-service-$pkgver"
# tests try to write to /var/lib/lomiri-location-service/config.ini
options="!check"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=ON \
		-DCMAKE_BUILD_TYPE=None \
		-DLOCATION_SERVICE_ENABLE_GPS_PROVIDER=OFF
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
cb336690469c97780348de86ba6881228160f3f7ef5c548cd7238fcaeca5f35b1fbd2fb5897d20a805e922b63e2592c159d93747ecfdd7ef94b40c4d5b708838  location-service-3.1.0.tar.gz
a593923e4a997977bdab1b7e72bfefbe401c5cb12c15d137e67c7e3527d3b0cd2be10a376140f081a5922d347bb5bce4c88140f33e53f1580bfdaad2a9f36f46  cstdint.patch
dd27a2902923321da01ab286d0bad1eba0a112b81c0c40b988bf4c0ae119577e7347b9ca8af6781f22330888a3298105cf072c66e77f1e77ef69ee9664cade9b  glog.patch
d156d17ab6415f68b70efbcc23e1373a7183cb38d1fec939d8aab9a5d6ebc645ba2737e0c1fc49a03a62f9a1dd3128f65a5536b9009740ed129e07760513ac0d  0001-data-CMakeLists.txt-don-t-hardcode-lib-paths-when-in.patch
"
